home *** CD-ROM | disk | FTP | other *** search
- Path: news.compuserve.com!newsmaster
- From: 71247.3221@compuserve.com (Don Wallace)
- Newsgroups: comp.lang.c++
- Subject: Re: Communication between WIN apps?
- Date: Thu, 21 Mar 1996 17:34:04 GMT
- Organization: CompuServe Incorporated
- Message-ID: <4irph0$q1e@dub-news-svc-1.compuserve.com>
- References: <4im3n4$hor@lantana.singnet.com.sg>
- NNTP-Posting-Host: hd27-073.compuserve.com
- X-Newsreader: Forte Free Agent v0.55
-
- mikhail@singnet.com.sg (Mikhail Choo W.M.) wrote:
-
- >Hi there,
- > I was wondering if there is a way for windows applications to communicate
- >between one another. I have looked high and low, and couldn't find any functions
- >that would do the tasks. Alas, I found an example of a program that is able to
- >communicate, BUT the program is sooooo dammed long and I am just wondering if
- >any of you have any better ideas. Oh yes, the app I found comes with borland C++
- >4.5 and is called <tstapp>. So, any ideas on how to pass variables to and fro.
- >Any help or ideas will be greatly appreciated.
- >--------------------------------------------------------
- >Yours, Mikhail Choo W. M.
- > Carpedium!
- >E-Mail: mikhail@singnet.com.sg sieze the day... > s7700017@singnet.com.sg
- >--------------------------------------------------------
-
- You could define your own Windows messages. The constant WM_USER is
- the base of a range of mesage 'slots' available for application
- defined purposes. You could define a private, low-overhead message
- 'channel' between apps.
-
- You then need a window owned by each app which provides the
- source/destination of the messages. This window should be hidden in
- each app and reserved for messaging. Messages sent to an app for
- communication purposes would be directed to this window. Each side
- could use 'FindWindow()' to locate the HWND handle.
-
- Lastly, you need to define a protocol. If you have a complex thing to
- send, I'd use a memory struct to pass the message information.
- An example protocol would be to use 'SendMessage' to send the message
- WM_USER+1000; the 'lParam' would be a far pointer at the memory
- structure; both sides would have to agree on the format of the struct.
-
- This scheme is very simple to implement and has the advantage of not
- using any external DLLs or APIs except SendMessage. But it's not good
- for end user programmability.
-
- On the other hand, you could use DDE, but its API may be a bit more
- cumbersome.
-
- - Don
-
-